<include file="Public/header.html"/>
</head>
<body>
<style>
	.layui-form-pane .layui-input-inline{width: 130px;}
	.layui-btn-xs{margin-left: 0 !important;}
</style>
<div class="x-nav">
	<span class="layui-breadcrumb">
	  <a><cite>首页</cite></a>
	  <a><cite>用户</cite></a>
	  <a><cite>团队审核</cite></a>
	</span>
   <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right;height:30px;padding: 0 15px;"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
	<form class="layui-form x-center" action="{:U('Home/Web/User/userteam_check')}" method="post">
		<div class="layui-form-pane" style="margin-top: 15px;">
			<div class="layui-form-item">             	                            
				<div class="layui-input-inline">
					<input type="text" name="nickname" value="{$nickname}"  placeholder="请输入微信昵称" autocomplete="off" class="layui-input">
				</div>
				<input type="hidden" name="distributor_id" value="{$distributor_id}" />
				<div class="layui-input-inline" style="width:80px">
					<button class="layui-btn" type="submit"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
				</div>
			</div>
		</div> 
	</form>
	<form id="delform" class="layui-form">    	 	
		<table class="layui-table">     	 		
			<thead>
				<tr>
					<th>ID</th>
					<th>真实姓名</th>
					<th>手机号</th>
					<th>头像</th>
					<th>微信昵称</th>
					<th>性别</th>
					<th>备注</th>
					<th>上级</th>
					<th>状态</th>
					<th>时间</th>
					<th>操作</th>
				</tr>
			</thead>
	  
			<tbody id="formdata">
				<volist name="list" id="v">	
				<tr>
					<td>{$v.id}</td>
					<td>{$v.true_name}</td>
					<td>{$v.phone}</td>
					<td><img src="{$v.avatar}" style="width: 50px;" alt="" /></td>
					<td>{$v.nickname}</td>
					<td><?php 
						if($v['sex']==1){
							echo '男';
						}else if($v['sex']==2){
							echo '女';
						}else{
							echo '保密';
						}
					?>
					</td>
					<td>{$v.remark}</td>
					<td><?php if($v['sup_promoter']){ ?>{$v.sup_promoter}<?php }else{ ?>暂无<?php } ?></td>
					<td>
						<if condition="$v['status'] eq 1">
							<font color="#0000FF">审核中</font>
						<elseif condition="$v['status'] eq 2" />
							<font color="#c22525">已拒绝</font>
						<elseif condition="$v['status'] eq 3" />
							<font color="#008000">已通过</font>
						</if>
					</td>
					<td><?php echo date('Y-m-d H:i:s', $v['add_time']); ?></td> 
					<td>
						<if condition="$v['status'] eq 1">
							<span class="layui-btn layui-btn-xs layui-btn-normal"  onclick="do_check('{$v['id']}')">审核</span>
						</if>
					</td>
				</tr>
				</volist>  
			</tbody>
		</table>
	</form>
	<span class="x-right" style="line-height:40px">共有数据：{$count} 条</span>
	<div id="page"></div>
	</div>
	<include file="Public/footer.html"/>
	<script src="__ROOT__/Public/js/jquery.wallform.js"></script>
	<script>    	
		layui.use(['form','element','laypage','layer'], function(){
			var laypage = layui.laypage;//分页
			var layer = layui.layer;//弹出层
			var form = layui.form;
			$ = layui.jquery; 
		  
			laypage.render({
				elem: 'page',
				count: '{$count}',
				limit: '{$limit}',
				curr : '{$page}', 
				jump: function(obj, first){
					if(!first){ 
						var $purl = "{:U('Home/Web/User/userteam_check',array('page'=>'pageval','nickname'=>$nickname))}"
						window.location.href= $purl.replace('pageval',obj.curr);  			
					}
				}
			});
			
		});
		
		function do_check(id){
		    layer.confirm('请选择同意或拒绝', {
		      btn: ['同意', '拒绝'] //可以无限个按钮
		    }, function(index, layero){
		    	layer.closeAll();
		    	var loading = layer.msg('加载中...', {icon: 16,shade: 0.3,time: 60*1000});
		    	$.ajax({
		    	    type: "POST",
		    	    url: "{:U('Home/Web/User/do_check')}", 
		    	    data: {"id": id,"status":3},
		    	    success: function (data) {
		    	        layer.close(loading);
		    	        if(data=='1'){
		    	        	parent.layer.msg('提交成功！', {icon: 1,offset: '40%',time:1500,shade: 0.3},function(){
		    	        		location.reload();
		    	        	});   
		    	        }else if(data=='2'){
		    	        	parent.layer.msg('提交失败！', {icon: 2,offset: '40%',time:1500,shade: 0.3});
		    	        }else{
		    	        	parent.layer.msg(data, {icon: 2,offset: '40%',time:1500,shade: 0.3});
		    	        }
		    	    }
		    	});
		    }, function(index, layero){
				var loading = layer.msg('加载中...', {icon: 16,shade: 0.3,time: 60*1000});
				$.ajax({
					type: "POST", 
					url: "{:U('Home/Web/User/do_check')}", 
					data: {"id": id,"status":2},
					success: function (data) {
					layer.close(loading);
						if(data=='1'){
							parent.layer.msg('提交成功！', {icon: 1,offset: '40%',time:1500,shade: 0.3},function(){
								location.reload();
							});   
						}else if(data=='2'){
							parent.layer.msg('提交失败！', {icon: 2,offset: '40%',time:1500,shade: 0.3});
						}else{
							parent.layer.msg(data, {icon: 2,offset: '40%',time:1500,shade: 0.3});
						}
					}
				});
		    });
			
		}
	</script>  
</div>	
</body>
</html>